package boot

import (
	"log"

	"gin.andbridge/config"
	"gin.andbridge/utils/read"
)

type Server struct {
	*config.Server
}

func ServerInit() *Server {
	reader := read.NewReader()
	serverConf := &config.Server{}
	err := reader.ReadJustPiece("Server", serverConf)
	if err != nil {
		log.Panicf("服务参数初始化错误:%v", err)
	}
	return &Server{serverConf}
}

func (server *Server) serverArgs() *config.Server {
	return &config.Server{
		RunMode:       server.RunMode,
		HostPort:      server.HostPort,
		ServerVersion: server.ServerVersion,
	}
}
